package com.app.ryjy.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 毕业生类别枚举
 */
@AllArgsConstructor
@Getter
public enum GraduateCategoryEnum {
    // 普通高校毕业生
    GENERAL_COLLEGE_GRADUATE("普通高校毕业生", 1, -1),
    // 技校毕业生
    TECHNICAL_SCHOOL_GRADUATE("技校毕业生", 2, -1),
    // 大中专毕业生
    SECONDARY_COLLEGE_GRADUATE("大中专毕业生", 3, -1),
    // 其他
    OTHER("其他", 4, -1);

    private final String desc;
    private final int code;
    private final int bizCode;

    /**
     * 根据 bizCode 获取 code
     *
     * @param bizCode bizCode
     * @return code
     */
    public static int getCodeByBizCode(int bizCode) {
        for (GraduateCategoryEnum category : values()) {
            if (category.getBizCode() == bizCode) {
                return category.getCode();
            }
        }
        throw new RuntimeException("bizCode 不存在");
    }

    public static void main(String[] args) {
        System.out.println(GraduateCategoryEnum.getCodeByBizCode(1));
    }
}